package com.gw.vip.center.controller;

import com.gw.vip.center.auth.CheckMailAuthCode;
import com.gw.vip.center.dto.MailRegisterDto;
import com.gw.vip.center.vo.MailRegisterVo;
import com.gw.vip.center.zib.RegisterBiz;
import com.gw.vip.common.log.PrintlnLog;
import com.gw.vip.common.vo.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author GW
 * @description
 * @since 2022-04-17
 */
@RestController
@RequestMapping("register")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RegisterController {

    private final RegisterBiz registerBiz;

    @PrintlnLog(description = "邮箱注册")
    @RequestMapping("mailRegister")
    @CheckMailAuthCode
    public Result mailRegister(@RequestBody @Valid MailRegisterDto dto){
        MailRegisterVo vo = registerBiz.mailRegister(dto);
        return Result.success(vo);
    }
}
